package com.ldx.springaopdemo.respect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;
@Slf4j
@Aspect

public class AspectDemo {
    @Around("execution(* com.ldx.springaopdemo.controller.*.*(..))")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable{
        log.info("Around 方法开始执行");
        Object result = joinPoint.proceed();
        log.info("Around 方法执行结束");
        return result;
    }
    @Before("execution(* com.ldx.springaopdemo.controller.*.*(..))")
    public void doBefore(){
        log.info("do before");
    }
    @After("execution(* com.ldx.springaopdemo.controller.*.*(..))")
    public void doAfter(){
        log.info("do After");
    }
    @AfterReturning("execution(* com.ldx.springaopdemo.controller.*.*(..))")
    public void doAfterReturning(){
        log.info("doAfterReturning");
    }
    @AfterThrowing("execution(* com.ldx.springaopdemo.controller.*.*(..))")
    public void doAfterThrowing(){
        log.info("oAfterThrowing");
    }
}
